
package jpoco.client;

@SuppressWarnings("serial")
public class ClientSettings implements java.io.Serializable
{
	private String oAuthCallbackUrl;
	private String oAuthRequestTokenUrl;
	private String oAuthAuthorizeUrl;
	private String oAuthAccessTokenUrl;
	private String endpointUrl;
	private Token consumerToken;
	private Token userSpecificAccessToken;
	private boolean openSocial = false;
	private boolean supportsFiltering = true;
	private String providerName; 
	private Format format = Format.XML;
	private boolean usesOAuth = true;
	private String scope = null;
	
	public ClientSettings()
	{
		super();
	}
	
	public boolean needsOAuthConfig()
	{
		return ( (oAuthRequestTokenUrl == null)
				 || (oAuthAuthorizeUrl == null)
				 || (oAuthAccessTokenUrl == null));
	}
	
	public boolean needsEndpoint()
	{
		return this.getEndpointUrl() == null;
	}
	
	public String getOAuthCallbackUrl()
	{
		return oAuthCallbackUrl;
	}
	public void setOAuthCallbackUrl(String url)
	{
		oAuthCallbackUrl = url;
	}
	
	public String getOAuthRequestTokenUrl()
	{
		return oAuthRequestTokenUrl;
	}
	
	public void setOAuthRequestTokenUrl(String url)
	{
		oAuthRequestTokenUrl = url;
	}
	
	public String getOAuthAuthorizeUrl()
	{
		return oAuthAuthorizeUrl;
	}
	
	public void setOAuthAuthorizeUrl(String url)
	{
		oAuthAuthorizeUrl = url;
	}
	
	public String getOAuthAccessTokenUrl()
	{
		return oAuthAccessTokenUrl;
	}
	
	public void setOAuthAccessTokenUrl(String url)
	{
		oAuthAccessTokenUrl = url;
	}


	public String getEndpointUrl()
	{
		return endpointUrl;
	}

	public void setEndpointUrl(String url)
	{
		this.endpointUrl = url;
	} 


	public void setConsumerToken(Token t)
	{
		this.consumerToken = t;
	}
	
	public Token getConsumerToken()
	{
		return consumerToken;
	}

	public Token getUserSpecificAccessToken()
	{
		if (userSpecificAccessToken == null)
		{
			userSpecificAccessToken = new Token();
		}
		return userSpecificAccessToken;
	}

	public void setUserSpecificToken(Token t)
	{
		this.userSpecificAccessToken = t;
	}

	
	public void setOpenSocial(boolean b)
	{
		this.openSocial = b;
	}
	
	public boolean isOpenSocial()
	{
		return openSocial;
	}
	
	public void setProviderName(String name)
	{
		providerName = name;
	}
	
	public String getProviderName()
	{
		return providerName;
	}

	public void setFormat(Format f)
	{
		this.format = f;
	}
	
	public Format getFormat()
	{
		return format;
	}

	
	

	public boolean getUsesOAuth()
	{
		return usesOAuth;
	}

	public void setUsesOAuth(boolean usesOAuth)
	{
		this.usesOAuth = usesOAuth;
	}

	
	public boolean getSupportsFiltering()
	{
		return supportsFiltering;
	}

	public void setSupportsFiltering(boolean b)
	{
		this.supportsFiltering = b;
	}

	public String getScope()
	{
		return scope;
	}

	public void setScope(String s)
	{
		this.scope = s;
	}

	public String toString()
	{
		if (this.getProviderName() != null)
		{
			return this.getProviderName();
		}
		else
		{
			return super.toString();
		}
	}
}
